package com.buaa.utility.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class Action {
	public abstract void execute(HttpServletRequest request, HttpServletResponse response) throws Exception;
	
	public static  void sendRedirect(String uri,HttpServletRequest request, HttpServletResponse response) throws IOException{
		response.sendRedirect(request.getContextPath()+uri);
	}
	public static  void forward(String uri,HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		RequestDispatcher dipatcher = request.getRequestDispatcher(uri);
		dipatcher.forward(request,response);
	}
}
